<template>
  <div>
    <!-- 头部1 -->
    <div class="hpart1">
      <div class="hmiddle">
        <div :class="{ cur: curindex == 0 }" @click="curs(0)">
          <a>公众版本</a>
        </div>
        <div :class="{ cur: curindex == 1 }" @click="curs(1)">
          <a>员工/学生版</a>
        </div>
        <div class="hsearch">
          <i class="iconfont icon-search"></i>
        </div>
        <div class="search">
          <div>
            <input type="text" placeholder="请输入您想搜索的内容" />
            <i class="iconfont icon-search"></i>
          </div>
        </div>
      </div>
    </div>
    <div class="hpart2">
      <div class="hmiddle2">
        <div class="h2logo">
          <router-link to="/index"
            ><img src="/img/logo.png" alt=""
          /></router-link>
        </div>
        <div class="hnav">
          <ul>
            <li :class="{ curnav: navcur == 0 }" @click="navcurs(0)">
              <i class="iconfont icon-xiajiantou"></i>
              <router-link to="/index">首页</router-link>
            </li>
            <li :class="{ curnav: navcur == 1 }" @click="navcurs(1)">
              <i class="iconfont icon-xiajiantou"></i>
              <router-link to="/yygk">医院概况</router-link>
              <div class="drop-down-menu">
                <div class="jt"></div>
                <div>医院简介</div>
                <div>组织机构</div>
                <div>科室导航</div>
                <div>厉/现任领导</div>
              </div>
            </li>
            <li :class="{ curnav: navcur == 2 }" @click="navcurs(2)">
              <i class="iconfont icon-xiajiantou"></i
              ><router-link to="/hzfw">大众服务</router-link>
              <div class="drop-down-menu">
                <div class="jt"></div>
                <div><router-link to="/hsyy">核酸预约/挂号</router-link></div>
                <div>门诊就医指南</div>
                <div>出/入院服务</div>
                <div>交通路线</div>
                <div>院区分布</div>
              </div>
            </li>
            <li :class="{ curnav: navcur == 3 }" @click="navcurs(3)">
              <i class="iconfont icon-xiajiantou"></i><a>医学教学</a>
              <div class="drop-down-menu">
                <div class="jt"></div>
                <div>本科教育</div>
                <div>研究生教育</div>
                <div>毕业后教育</div>
                <div>医学模拟中心</div>
                <div>医学技术学院</div>
              </div>
            </li>
            <li :class="{ curnav: navcur == 4 }" @click="navcurs(4)">
              <i class="iconfont icon-xiajiantou"></i><a>科学研究</a>
            </li>
            <li :class="{ curnav: navcur == 5 }" @click="navcurs(5)">
              <i class="iconfont icon-xiajiantou"></i><a>专家介绍</a>
            </li>
            <li :class="{ curnav: navcur == 7 }" @click="navcurs(7)">
              <i class="iconfont icon-xiajiantou"></i><a>百年华西</a>
            </li>
             <li :class="{ curnav: navcur == 6 }" @click="navcurs(6)">
              <i class="iconfont icon-xiajiantou"></i
              ><router-link to="/news">新闻中心</router-link>
            </li>
            <li :class="{ curnav: navcur == 8 }" @click="navcurs(8)">
              <i class="iconfont icon-xiajiantou"></i>
              <router-link to="/hxxy"> 华西校友</router-link>
            </li>
            <li :class="{ curnav: navcur == 9 }" @click="navcurs(9)">
              <i class="iconfont icon-xiajiantou"></i>
              <router-link to="/hxylt">华西医联体</router-link>
            </li>
            <li :class="{ curnav: navcur == 10 }" @click="navcurs(10)">
              <i class="iconfont icon-xiajiantou"></i><router-link to="/hxcy">华西产业</router-link>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import "@/assets/js/header";
export default {
  data() {
    return {
      curindex: 0,
      navcur: 0,
    };
  },
  methods: {
    curs(index) {
      this.curindex = index;
    },
    navcurs(index) {
      this.navcur = index;
    },
  },
  watch: {
    $route(newValue, oldValue) {
      console.log(newValue);
      if (newValue.path == "/index") {
        this.navcur = 0;
      } else if (newValue.path == "/yygk") {
        this.navcur = 1;
      } else if (newValue.path == "/hxxy") {
        this.navcur = 8;
      } else if (newValue.path == "/news") {
        this.navcur = 6;
      } else if (newValue.path == "/hzfw") {
        this.navcur = 2;
      }else if (newValue.path == "/hxylt") {
        this.navcur = 9;
      }else if (newValue.path == "/hxcy") {
        this.navcur = 10;
      }
      
    },
  },
};
</script>
<style lang="scss" scoped>
.hnav {
  position: relative;
  top: 15px;
}
.hpart2 a {
  color: #333333;
  text-decoration: none;
  &:hover {
    color: #c7a368;
  }
  &.curnav {
    color: #c7a368;
  }
}
.drop-down-menu {
  display: none;
  z-index: 12;
  .jt {
    width: 20px;
    height: 20px;
    background-color: #fff;
    transform: translate(-50%, -50%) rotate(45deg);
    position: absolute;
    top: -20px;
    left: 50%;
  }
  > div {
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    color: #474747;
    margin: 20px 0;
    &:hover {
      color: #c7a368;
    }
  }
  margin-top: 10px;
  padding-top: 20px;
  top: 84px;
  text-align: center;
  position: absolute;
  width: 130px;
  background-color: #fff;
}
.hpart2 {
  margin: auto;
  max-width: 1920px;
  background-color: #eee;
  .hmiddle2 {
    position: relative;
    .h2logo {
      top: -49px;
      position: absolute;
      background-color: #fff;
      width: 250px;
      height: 168px;
      img {
        width: 100%;
        height: 100%;
        box-shadow: 1px 1px 10px #808080;
      }
    }
    max-width: 1180px;
    margin: auto;
    height: 119px;
    display: flex;
    align-items: center;
    ul {
      margin-top: 20px;
      margin-left: 260px;
      display: flex;
      li {
        box-sizing: border-box;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        text-align: center;
        align-items: center;
        > a {
          white-space: nowrap;
        }
        &:hover i {
          display: block;
        }
        &:hover {
          color: #c7a368;
        }
        i {
          display: none;
          top: 30px;
          position: absolute;
          font-size: 25px;
          color: #c7a368;
        }
        padding: 35px 11px;
        &.curnav {
          i {
            display: block;
          }
          color: #c7a368;
        }
      }
    }
  }
}
.hpart1 {
  margin: auto;
  max-width: 1920px;
  background-color: #6d1d29;
  .hmiddle {
    position: relative;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: end;
    height: 49px;
    max-width: 1180px;
    background-color: #6d1d29;
    color: #fff;
    font-size: 14px;
    > div {
      cursor: pointer;
      border-right: 1px solid #ddd;
      padding: 0 13px;
      &.cur {
        color: #c7a368;
      }
    }
    > div:nth-child(3) {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      margin-left: 13px;
      i {
        font-size: 22px;
      }
      background-color: #902d3b;
    }
  }
}
.search {
  z-index: 10;
  background-color: #fff;
  display: flex;
  align-items: center;
  height: 36px;
  position: absolute;
  right: 0;
  top: 60px;
  border-radius: 5px;
  font-size: 16px;
  color: #000;
  border: 1px solid #ddd;
  input {
    height: 20px;
    border: 0;
    outline: none;
  }
  i {
    font-weight: bold;
    font-size: 16px;
    margin-left: 10px;
  }
}
</style>